package com.allwees.bs.module.wms.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.allwees.bs.module.wms.entity.WmsPickOrderSku;
import com.allwees.core.common.constant.EStatus;
import com.allwees.core.dao.mybatis.dao.BaseDao;

public interface WmsPickOrderSkuDao extends BaseDao<WmsPickOrderSku> {

    default Integer findCountByPickOrderUuid(String pickOrderUuid) {
        return findCountByPickOrderUuid(pickOrderUuid, null);
    }

    default Integer findCountByPickOrderUuid(String pickOrderUuid, EStatus status) {
        QueryWrapper<WmsPickOrderSku> wrapper = new QueryWrapper<WmsPickOrderSku>().eq("pick_order_uuid", pickOrderUuid);
        if(status != null){
            wrapper.eq("status", status.value());
        }
        return selectCount(wrapper);
    }
 }
